dofile "data/prototypes.lua"

character_mt = {
  private = {
    __type ="character"
  },
  __index = function(t,k)
    return character_mt.private[k]
  end,
  __tostring = function(self)
    return self.name
  end,  
}

charA = {
  name = "Gaia the Gibborim",
  stats = { --persisted
     body = 35,
     mind = 35,
     soul = 30,
  },
  cards = { --persisted
  
  },
  skills = {  --persisted and runtime
     base = { --persisted
     
     }, 
     --runtime
  
  },
  status = { --runtime only, time dependant
     stamina = 100,
     faculty = 100,
     virtue  = 100,
     lastdrain = 0,
  },
  bonus = { --runtime only, determine by cards 
     matterorform = 25,
     lightordark = 10,
     selforother = 15,
  }
}
setmetatable(charA,character_mt)

charB = {
  name = "Omega the Gibborim",
  stats = { --persisted
     body = 35,
     mind = 35,
     soul = 30,
  },
  cards = { --persisted
  
  },
  skills = {  --persisted and runtime
     base = { --persisted
     
     }, 
     --runtime
  
  },
  status = { --runtime only, time dependant
     stamina = 100,
     faculty = 100,
     virtue  = 100,
     lastdrain = 0,
  },
  bonus = { --runtime only, determine by cards 
     matterorform = 25,
     lightordark = 10,
     selforother = 15,
  }
}
setmetatable(charB,character_mt)

robert= {"Robert", --name
        35,35,30, --stats
        1,2,3,4,5,6,7,8,9,10, --equiped
        -- cards --
        id("item",1),id("item",2),id("item",3),id("item",4),id("item",5),
        nil,nil,nil,nil,nil,
        nil,nil,nil,nil,nil,
        nil,nil,nil,nil,nil,
        nil,nil,nil,nil,nil,
        nil,nil,nil,nil,nil,
        nil,nil,
        -- aspect --
        1,1,1,1,1,1,1,1,1,1, --body
        1,1,1,1, --head
       }
        
loadcharacter = function(data)
  local c = {}
  c.name = data[1]
  c.stats = {
    body = data[2],
    mind = data[3],
    soul = data[4],
  }
  c.equiped = {
     head = data[5],     body = data[6],      feet = data[7],
     larm = data[8],     rarm = data[9],
     slot1= data[10],    slot2= data[11],     slot3= data[12],
     slot4= data[13],    slot5= data[14],
  }
  c.cards = {
     data[15],data[16],data[17],data[18],data[19],data[20],data[21],data[22],
     data[23],data[24],data[25],data[26],data[27],data[28],data[29],data[30],
     data[31],data[32],data[33],data[34],data[35],data[36],data[37],data[38],
     data[39],data[40],data[41],data[42],data[43],data[44],data[45],data[46],
  }
  c.aspect = {
    body = {data[47],data[48],data[49],data[50],data[51],
            data[52],data[53],data[54],data[55],data[56],
           },
    head = {data[57],data[58],data[59],data[60],    
           },
  }
  c.skills = {
  
  }
  c.status = {
     stamina = 100,
     faculty = 100,
     virtue  = 100,
     lastdrain = 0,
  }
  c.bonus = { 
     matterorform = 0,
     lightordark  = 0,
     selforother  = 0,
     fire   = 0,
     water  = 0,
     earth  = 0,
     air    = 0,
     nature = 0,
     tech   = 0,
  }
  setmetatable(c,character_mt)
  return c
end

--charA = loadcharacter(robert)

characters = {charA,charB}
